package com.totem.base.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum LoginTypeEnum {
    NICKNAME("NICKNAME"),
    MOBILE("MOBILE"),
    EMAIL("EMAIL");

    private final String code;

    LoginTypeEnum(String code){
        this.code = code;
    }

    public static LoginTypeEnum byCode(String code) {
        for (LoginTypeEnum e: LoginTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isMobile(String code){
        return MOBILE.code.equalsIgnoreCase(code);
    }
    public static boolean isEmail(String code){
        return EMAIL.code.equalsIgnoreCase(code);
    }
}
